home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group00b.txt / 000087_icon-group-sender_Mon Oct 23 08:17:58 2000.msg < prev    next >
Internet Message Format  |  2001-01-03  |  2KB

  1. Return-Path: <icon-group-sender>
  2. Received: (from root@localhost)
  3.     by baskerville.CS.Arizona.EDU (8.11.1/8.11.1) id e9NFHa318406
  4.     for icon-group-addresses; Mon, 23 Oct 2000 08:17:36 -0700 (MST)
  5. Message-Id: <200010231517.e9NFHa318406@baskerville.CS.Arizona.EDU>
  6. From: Cheyenne Wills <cheyenne_wills@qwest.net>
  7. X-Accept-Language: en
  8. X-Newsgroups: comp.lang.icon
  9. Subject: Re: How to "declare" a string?
  10. Date: Sun, 22 Oct 2000 15:28:41 -0600
  11. X-Trace: news.uswest.net 972250031 63.227.115.85 (Sun, 22 Oct 2000 16:27:11 CDT)
  12. To: icon-group@cs.arizona.edu
  13. Errors-To: icon-group-errors@cs.arizona.edu
  14. Status: RO
  15. Content-Length: 1144
  16.  
  17.  
  18. > traditional sense of a programming language. Soooo...uhhh....???
  19. > As a secondary question, this is part of a program to converst a string
  20. > to all uppercase. Right now I'm doing in a WHILE...DO loop. But
  21. > something tells me there's amcuh more efficient way to do it (with EVERY
  22. > perhaps?) Any suggestions?
  23.  
  24. data := "Some MiXed CaSed Data"
  25. newdata := map(data,&lcase,&ucase)
  26.  
  27. --> newdata now contains "SOME MIXED CASED DATA"
  28.  
  29. The map function searches in the first parameter every instance of each
  30. character in the second parameter and replaces that character with a
  31. character from the third parameter that is in the same "position" as the
  32. character in the 2nd...
  33.  
  34. I hope that sounded clear...
  35.  
  36. Here is an example:
  37.  
  38. #                12345   12345
  39. map("some data","aeiou","!@#$%")  -> "s$m# d!t!"
  40.  
  41. The above does the following mapping
  42.  
  43.    a -> !
  44.    e -> @
  45.    i -> #
  46.    o -> $
  47.    u -> %
  48.  
  49. You can also use map to rearrange data
  50. #    mm/dd/yyyy   yyyy/mm/dd   mm/dd/yyyy  
  51. map("123456789A","789A612345","10/21/2000")
  52.  
  53. Will transform a date in the format of mm/dd/yyyy into yyyy/mm/dd.  It
  54. uses the third parameter as the "input"
  55.  
  56. Cheyenne
  57.